#pragma once

#include <string>
using namespace std;

#include "pugixml/pugixml.hpp"

#include "topcvt_cross_platform.hpp"
#include "topcvt_policy_factory.hpp"
#include "topcvt_exception.hpp"
#include "topcvt_buffer.hpp"
#include "topcvt_policycontext.hpp"
#include "topcvt_exprparser.hpp"
#include "topcvt_cfg_parser.hpp"
#include "topcvt_policyhelper.hpp"

namespace topcvt
{
	class PackImp
	{		
	protected:
		ByteBuffer m_message;
		map<string,string> m_atx;
	public:
		PackImp();
		virtual ~PackImp(){};

		inline map<string,string>& getAtx() { return m_atx;};

		virtual void checkElementCfgValid(AttributeableCfg& attributeableCfg);
		virtual void packField(pugi::xml_node& node, FieldCfg& cfg, PolicyContext& ctx) {};
		
		virtual string packPolicy(PolicyContext& policyContext, PolicyCfg& policyCfg);
		virtual void pack(pugi::xml_node& node, PolicyContext& ctx);
		virtual void packPolicy(pugi::xml_node& node, PolicyCfg& cfg,PolicyContext& ctx);
		virtual void packInclude(pugi::xml_node& node, IncludeCfg& cfg,PolicyContext& ctx);
		virtual void packStruct(pugi::xml_node& node, StructCfg& cfg,PolicyContext& ctx);
		virtual void packLoop(pugi::xml_node& node, LoopCfg& cfg,PolicyContext& ctx);
		virtual void packSwitch(pugi::xml_node& node, SwitchCfg& cfg,PolicyContext& ctx);
		virtual void packCase(pugi::xml_node& node, CaseCfg& cfg,PolicyContext& ctx);		
	};
};


